import sqlhelper
class dirdb():
    db =None
    c = None
    dbconn = None
    def createDb(self):
        self.db = sqlhelper.db()
        self.dbconn = self.db.createdb("test.db");
        self.c = self.db.getCursor(self.dbconn)
        cnt = self.db.getDbTblCnt(self.c)
        #print cnt
        if cnt == 0:
            self.db.execsql(self.c,"create table fileTbl(filename TEXT,filePath TEXT,MD5 TEXT)")
    def insertData(self,filename,filepath,md5):
        sql = 'insert into fileTbl (filename,filePath,MD5) values("%s","%s","%s")' % (filename,filepath,md5)
        #print sql
        self.db.execsql(self.c,sql)
        self.dbconn.commit()
    def queryMD5(self,md5):
        sql = "select * from fileTbl where MD5=" + '"' + md5 +'"'
        self.db.execsql(self.c,sql)
#test
'''
d = dirdb()
d.createDb()
d.insertData('"a"','"b"','"abc"'); #check if no double quote (")

'''
